package org.travel_system.mapper;

import org.apache.ibatis.annotations.*;
import org.travel_system.pojo.Performance;

import java.util.List;

@Mapper
public interface PerformanceMapper {

    //查询演出列表
    @Select("select * from performance")
    List<Performance> getPerformances();

    //根据名字查询
    @Select("select * from performance where performance_name=#{name}")
    Performance getPerformanceByName(String name);

    //添加演出
    @Insert("insert into performance(performance_name, phone_number, performance_time, description, photo) " +
            "values (#{performanceName},#{phoneNumber},#{performanceTime},#{ description},#{photo})")
    int addPerformance(Performance performance);

    //更新信息
    @Update("update performance set phone_number=#{phoneNumber},performance_time=#{performanceTime},description=#{description},photo=#{photo} where performance_name=#{performanceName}")
    int updatePerformance(Performance performance);

    //删除演出
    @Delete("delete from performance where performance_name=#{name}")
    int deletePerformance(String name);
}
